from django.db import models
from prj005.models.models import CreateTimeModel
from myuser.models import MyUser


class Info(CreateTimeModel):
    owner = models.ForeignKey(MyUser, on_delete=models.CASCADE, related_name='prj005_info')

    serial = models.CharField(unique=True, max_length=12, verbose_name='问卷编码', help_text='问卷编码')

    patient_name = models.CharField(max_length=20, verbose_name='患者姓名', help_text='患者姓名')

    patient_date = models.DateField(verbose_name='就诊日期', help_text='就诊日期')

    hospital_name = models.CharField(max_length=50, verbose_name='医院名称', help_text='医院名称')

    HOSPITAL_BS = (
        ('省级医院', '省级医院'),
        ('市级医院', '市级医院'),
        ('区/县级医院', '区/县级医院')
    )
    hospital_belong = models.CharField(max_length=10, choices=HOSPITAL_BS, verbose_name='医院所属', help_text='医院所属')

    patient_phone = models.CharField(max_length=11, blank=True, null=True, verbose_name='患者电话', help_text='患者电话')

    expert_name = models.CharField(max_length=20, blank=True, null=True, verbose_name='填表专家姓名', help_text='填表专家姓名')

    expert_hospital = models.CharField(max_length=50, blank=True, null=True, verbose_name='填表专家单位', help_text='填表专家单位')

    expert_phone = models.CharField(max_length=11, blank=True, null=True, verbose_name='填表专家电话', help_text='填表专家电话')

    expert_email = models.CharField(max_length=50, blank=True, null=True, verbose_name='填表专家邮箱', help_text='填表专家邮箱')

    TITLE_POSITION = (
        ('主任医师', '主任医师'),
        ('副主任医师', '副主任医师'),
        ('主治医师', '主治医师')
    )
    expert_title = models.CharField(max_length=20, blank=True, null=True, choices=TITLE_POSITION, verbose_name='填表专家职称', help_text='填表专家职称')

    address = models.CharField(max_length=150, blank=True, null=True, verbose_name='病人现住址', help_text='病人现住址')

    PATIENT_WHENCE_CHOICES = (
        ('门诊', '门诊'),
        ('病房', '病房')
    )
    patient_source = models.CharField(max_length=4, choices=PATIENT_WHENCE_CHOICES, blank=True, null=True, verbose_name='病人来源', help_text='病人来源')

    patient_birth = models.CharField(max_length=10, blank=True, null=True, help_text="出生日期[YYYY-MM]", verbose_name='出生[YYYY-MM]')

    patient_height = models.IntegerField(blank=True, null=True, verbose_name='身高', help_text='身高')

    patient_weight = models.DecimalField(max_digits=5, decimal_places=1, blank=True, null=True, verbose_name='体重', help_text='体重')

    nation = models.CharField(max_length=20, blank=True, null=True, verbose_name='民族', help_text='民族')

    PATIENT_CAREER_CHOICES = (
        ('学生', '学生'),
        ('专业技术人员', '专业技术人员'),
        ('机关、企业、单位负责人', '机关、企业、单位负责人'),
        ('军人', '军人'),
        ('农、林、牧、渔生产人员', '农、林、牧、渔生产人员'),
        ('办事人员和有关人员', '办事人员和有关人员'),
        ('商业和服务业人员', '商业和服务业人员'),
        ('生产运输、设备操作人员', '生产运输、设备操作人员'),
        ('无业', '无业'),
        ('其它', '其它')
    )
    patient_career = models.CharField(max_length=20, choices=PATIENT_CAREER_CHOICES, blank=True, null=True, verbose_name='职业', help_text='职业')

    patient_career_qita = models.CharField(max_length=50, blank=True, null=True, verbose_name='职业-其它', help_text='职业-其它')

    PATIENT_CULTURE_CHOICES = (
        ('未接受国家教育(文盲)', '未接受国家教育(文盲)'),
        ('小学及以下', '小学及以下'),
        ('初中', '初中'),
        ('高中/中专', '高中/中专'),
        ('大专', '大专'),
        ('本科', '本科'),
        ('研究生及以上', '研究生及以上'),
    )
    patient_culture = models.CharField(max_length=15, choices=PATIENT_CULTURE_CHOICES, blank=True, null=True, verbose_name='文化程度', help_text='文化程度')

    patient_lover = models.CharField(max_length=15, choices=PATIENT_CULTURE_CHOICES, blank=True, null=True, verbose_name='配偶的受教育程度', help_text='配偶的受教育程度')

    special_wu = models.BooleanField(blank=True, null=True, verbose_name='无', help_text='无')

    special_gao = models.BooleanField(blank=True, null=True, verbose_name='高温', help_text='高温')

    special_di = models.BooleanField(blank=True, null=True, verbose_name='低温', help_text='低温')

    special_chao = models.BooleanField(blank=True, null=True, verbose_name='潮湿', help_text='潮湿')

    special_zao = models.BooleanField(blank=True, null=True, verbose_name='噪声', help_text='噪声')

    special_fu = models.BooleanField(blank=True, null=True, verbose_name='辐射', help_text='辐射')

    special_hua = models.BooleanField(blank=True, null=True, verbose_name='化工', help_text='化工')

    special_xie = models.BooleanField(blank=True, null=True, verbose_name='鞋帽服装', help_text='鞋帽服装')

    special_qi = models.BooleanField(blank=True, null=True, verbose_name='汽油', help_text='汽油')

    special_kong = models.BooleanField(blank=True, null=True, verbose_name='高空', help_text='高空')

    special_zhuang = models.BooleanField(blank=True, null=True, verbose_name='装修', help_text='装修')

    special_tang = models.BooleanField(blank=True, null=True, verbose_name='烫发染发', help_text='烫发染发')

    special_qita = models.CharField(max_length=50, blank=True, null=True, verbose_name='其他', help_text='其他')

    # PATIENT_WORK_CHOICES = (
    #     ('I', 'I级（轻劳动）：坐姿、手工作业、仪器操作控制等'),
    #     ('II', 'II级（中等劳动）：护工、保洁、运输、搬运中等重物、粉刷、除草、锄田等'),
    #     ('III', 'III级（重劳动）：搬重物、挖掘、锤锻等'),
    #     ('IV', 'IV级（极重劳动）：大强度的挖掘、搬运等')
    # )
    # patient_work = models.CharField(max_length=8, choices=PATIENT_WORK_CHOICES, blank=True, null=True, verbose_name='职业体力劳动强度', help_text='职业体力劳动强度')

    patient_workstyle_julie = models.BooleanField(blank=True, null=True, verbose_name='剧烈运动(体育运动员)', help_text='剧烈运动(体育运动员)')

    patient_workstyle_jiuzuo = models.BooleanField(blank=True, null=True, verbose_name='久坐(文职人员)', help_text='久坐(文职人员)')

    patient_workstyle_jiuzhan = models.BooleanField(blank=True, null=True, verbose_name='久站(服务行业)', help_text='久站(服务行业)')

    patient_workstyle_ao = models.BooleanField(blank=True, null=True, verbose_name='熬夜(零点以后睡觉)', help_text='熬夜(零点以后睡觉)')

    patient_workstyle_ao_times = models.IntegerField(blank=True, null=True, verbose_name='熬夜(零点以后睡觉)-次/周', help_text='熬夜(零点以后睡觉)-次/周')

    eat_wu = models.BooleanField(blank=True, null=True, verbose_name='无特殊', help_text='无特殊')

    eat_suan = models.BooleanField(blank=True, null=True, verbose_name='酸', help_text='酸')

    eat_tian = models.BooleanField(blank=True, null=True, verbose_name='甜', help_text='甜')

    eat_xian = models.BooleanField(blank=True, null=True, verbose_name='咸', help_text='咸')

    eat_la = models.BooleanField(blank=True, null=True, verbose_name='辛辣', help_text='辛辣')

    eat_you = models.BooleanField(blank=True, null=True, verbose_name='油腻', help_text='油腻')

    eat_sheng = models.BooleanField(blank=True, null=True, verbose_name='生冷', help_text='生冷')

    eat_ka = models.BooleanField(blank=True, null=True, verbose_name='含咖啡因食物或饮品', help_text='含咖啡因食物或饮品')

    eat_su = models.BooleanField(blank=True, null=True, verbose_name='素食', help_text='素食')

    eat_qita = models.CharField(max_length=50, blank=True, null=True, verbose_name='其它', help_text='其它')

    hobby_wu = models.BooleanField(blank=True, null=True, verbose_name='无特殊', help_text='无特殊')

    hobby_xi = models.BooleanField(blank=True, null=True, verbose_name='吸烟', help_text='吸烟')

    hobby_xi_num = models.IntegerField(blank=True, null=True, verbose_name='吸烟-支', help_text='吸烟-支')

    hobby_yin = models.BooleanField(blank=True, null=True, verbose_name='饮酒', help_text='饮酒')

    hobby_cha = models.BooleanField(blank=True, null=True, verbose_name='饮茶', help_text='饮茶')

    hobby_kafei = models.BooleanField(blank=True, null=True, verbose_name='咖啡', help_text='咖啡')

    hobby_yin_num = models.IntegerField(blank=True, null=True, verbose_name='饮酒-量', help_text='饮酒-量')

    hobby_qita = models.CharField(max_length=50, blank=True, null=True, verbose_name='其它', help_text='其它')

    is_infection = models.BooleanField(blank=True, null=True, verbose_name='是否存在传染病', help_text='是否存在传染病')

    infection_bing = models.BooleanField(blank=True, null=True, verbose_name='病毒性肝炎', help_text='病毒性肝炎')

    infection_jie = models.BooleanField(blank=True, null=True, verbose_name='结核', help_text='结核')

    infection_lin = models.BooleanField(blank=True, null=True, verbose_name='淋病', help_text='淋病')

    infection_mei = models.BooleanField(blank=True, null=True, verbose_name='梅毒', help_text='梅毒')

    infection_ai = models.BooleanField(blank=True, null=True, verbose_name='艾滋病', help_text='艾滋病')

    infection_qita = models.CharField(max_length=50, blank=True, null=True, verbose_name='传染病-其他', help_text='传染病-其他')

    other_wu = models.BooleanField(blank=True, null=True, verbose_name='其他病史-无', help_text='其他病史-无')

    other_jiliu = models.BooleanField(blank=True, null=True, verbose_name='子宫肌瘤', help_text='子宫肌瘤')

    other_yiwei = models.BooleanField(blank=True, null=True, verbose_name='子宫内膜异位症', help_text='子宫内膜异位症')

    other_xianji = models.BooleanField(blank=True, null=True, verbose_name='子宫腺肌病', help_text='子宫腺肌病')

    other_yuxue = models.BooleanField(blank=True, null=True, verbose_name='盆腔淤血综合征', help_text='盆腔淤血综合征')

    other_chuxue = models.BooleanField(blank=True, null=True, verbose_name='异常子宫出血', help_text='异常子宫出血')

    other_kangjin = models.BooleanField(blank=True, null=True, verbose_name='甲状腺功能亢进', help_text='甲状腺功能亢进')

    other_dixia = models.BooleanField(blank=True, null=True, verbose_name='甲状腺功能低下', help_text='甲状腺功能低下')

    other_hongban = models.BooleanField(blank=True, null=True, verbose_name='系统性红斑狼疮', help_text='系统性红斑狼疮')

    other_yiyu = models.BooleanField(blank=True, null=True, verbose_name='焦虑症/抑郁症', help_text='焦虑症/抑郁症')

    other_qita = models.CharField(max_length=50, blank=True, null=True, verbose_name='其他疾病', help_text='其他疾病')

    first_time = models.IntegerField(blank=True, null=True, verbose_name='初潮年龄', help_text='初潮年龄')

    RULE_NORMAL_CHOICES = (
        ('尚规律', '尚规律'),
        ('不规律', '不规律')
    )
    rule_normal = models.CharField(max_length=4, choices=RULE_NORMAL_CHOICES, blank=True, null=True, verbose_name='月经周期', help_text='月经周期')

    duration_days = models.IntegerField(blank=True, null=True, verbose_name='行经天数', help_text='行经天数')

    QUANTITY_CHOICES = (
        ('正常', '正常'),
        ('量多', '量多'),
        ('量少', '量少')
    )
    blood_quantity = models.CharField(max_length=4, choices=QUANTITY_CHOICES, blank=True, null=True, verbose_name='月经量', help_text='月经量')

    CQ_CHOICES = (
        ('正常', '正常'),
        ('异常', '异常')
    )
    blood_color = models.CharField(max_length=4, choices=CQ_CHOICES, blank=True, null=True, verbose_name='经血颜色', help_text='经血颜色')

    blood_color_abnormal = models.CharField(max_length=100, blank=True, null=True, verbose_name='经血颜色-异常详情', help_text='经血颜色-异常详情')

    blood_quality = models.CharField(max_length=4, choices=CQ_CHOICES, blank=True, null=True, verbose_name='经血质地', help_text='经血质地')

    blood_quality_abnormal = models.CharField(max_length=100, blank=True, null=True, verbose_name='经血质地-异常详情', help_text='经血质地-异常详情')

    SYMPTOM_EXIST_CHOICES = (
        ('偶尔', '偶尔'),
        ('有时', '有时'),
        ('经常', '经常')
    )

    wu_symptom_futong = models.BooleanField(blank=True, null=True, verbose_name='经行腹痛-无', help_text='经行腹痛-无')

    symptom_futong = models.BooleanField(blank=True, null=True, verbose_name='经行腹痛', help_text='经行腹痛')

    symptom_futong_exist = models.CharField(max_length=4, choices=SYMPTOM_EXIST_CHOICES, blank=True, null=True, verbose_name='经行腹痛-有', help_text='经行腹痛-有')

    wu_symptom_yinu = models.BooleanField(blank=True, null=True, verbose_name='经行烦躁易怒-无', help_text='经行烦躁易怒-无')

    symptom_yinu = models.BooleanField(blank=True, null=True, verbose_name='经行烦躁易怒', help_text='经行烦躁易怒')

    symptom_yinu_exist = models.CharField(max_length=4, choices=SYMPTOM_EXIST_CHOICES, blank=True, null=True, verbose_name='经行烦躁易怒-有', help_text='经行烦躁易怒-有')

    wu_symptom_toutong = models.BooleanField(blank=True, null=True, verbose_name='经行头痛-无', help_text='经行头痛-无')
    symptom_toutong = models.BooleanField(blank=True, null=True, verbose_name='经行头痛', help_text='经行头痛')

    symptom_toutong_exist = models.CharField(max_length=4, choices=SYMPTOM_EXIST_CHOICES, blank=True, null=True, verbose_name='经行头痛-有', help_text='经行头痛-有')

    wu_symptom_suantong = models.BooleanField(blank=True, null=True, verbose_name='经行腰骶部胀痛或酸痛-无', help_text='经行腰骶部胀痛或酸痛-无')
    symptom_suantong = models.BooleanField(blank=True, null=True, verbose_name='经行腰骶部胀痛或酸痛', help_text='经行腰骶部胀痛或酸痛')

    symptom_suantong_exist = models.CharField(max_length=4, choices=SYMPTOM_EXIST_CHOICES, blank=True, null=True, verbose_name='经行腰骶部胀痛或酸痛-有', help_text='经行腰骶部胀痛或酸痛-有')

    wu_symptom_zhangtong = models.BooleanField(blank=True, null=True, verbose_name='经行乳房胀痛-无', help_text='经行乳房胀痛-无')
    symptom_zhangtong = models.BooleanField(blank=True, null=True, verbose_name='经行乳房胀痛', help_text='经行乳房胀痛')

    symptom_zhangtong_exist = models.CharField(max_length=4, choices=SYMPTOM_EXIST_CHOICES, blank=True, null=True, verbose_name='经行乳房胀痛-有', help_text='经行乳房胀痛-有')

    wu_symptom_exin = models.BooleanField(blank=True, null=True, verbose_name='经行恶心呕吐-无', help_text='经行恶心呕吐-无')
    symptom_exin = models.BooleanField(blank=True, null=True, verbose_name='经行恶心呕吐', help_text='经行恶心呕吐')

    symptom_exin_exist = models.CharField(max_length=4, choices=SYMPTOM_EXIST_CHOICES, blank=True, null=True, verbose_name='经行恶心呕吐-有', help_text='经行恶心呕吐-有')

    wu_symptom_xiexie = models.BooleanField(blank=True, null=True, verbose_name='经行泄泻-无', help_text='经行泄泻-无')
    symptom_xiexie = models.BooleanField(blank=True, null=True, verbose_name='经行泄泻', help_text='经行泄泻')

    symptom_xiexie_exist = models.CharField(max_length=4, choices=SYMPTOM_EXIST_CHOICES, blank=True, null=True, verbose_name='经行泄泻-有', help_text='经行泄泻-有')

    symptom_qita = models.CharField(max_length=50, blank=True, null=True, verbose_name='经行其他症状', help_text='经行其他症状')

    symptom_qita_exist = models.CharField(max_length=4, choices=SYMPTOM_EXIST_CHOICES, blank=True, null=True, verbose_name='经行其他症状-有', help_text='经行其他症状-有')

    # leukorrheal 白带(带下)
    LEUKORRHEAL_CHOICES = (
        ('正常', '正常'),
        ('异常', '异常'),
    )
    leukorrheal_quantity = models.CharField(max_length=4, choices=LEUKORRHEAL_CHOICES, blank=True, null=True, verbose_name='带下量', help_text='带下量')

    L_Q_CHOICES = (
        ('量多', '量多'),
        ('量少', '量少'),
    )
    leukorrheal_quantity_more = models.CharField(max_length=4, choices=L_Q_CHOICES, blank=True, null=True, verbose_name='带下量-异常', help_text='带下量-异常')

    leukorrheal_color = models.CharField(max_length=4, choices=LEUKORRHEAL_CHOICES, blank=True, null=True, verbose_name='带下颜色', help_text='带下颜色')

    leukorrheal_color_qita = models.CharField(max_length=50, blank=True, null=True, verbose_name='带下颜色-详述', help_text='带下颜色-详述')

    leukorrheal_feature = models.CharField(max_length=4, choices=LEUKORRHEAL_CHOICES, blank=True, null=True, verbose_name='带下性状', help_text='带下性状')

    leukorrheal_feature_qita = models.CharField(max_length=50, blank=True, null=True, verbose_name='带下性状-详述', help_text='带下性状-详述')

    leukorrheal_smell = models.CharField(max_length=4, choices=LEUKORRHEAL_CHOICES, blank=True, null=True, verbose_name='带下气味', help_text='带下气味')

    leukorrheal_smell_qita = models.CharField(max_length=50, blank=True, null=True, verbose_name='带下气味-详述', help_text='带下气味-详述')

    MARRIAGE_CHOICES = (
        ('未婚', '未婚'),
        ('已婚', '已婚'),
        ('离异', '离异'),
        ('丧偶', '丧偶'),
        ('再婚', '再婚'),
        ('其他', '其他')
    )
    marriage = models.CharField(max_length=10, choices=MARRIAGE_CHOICES, blank=True, null=True, verbose_name='婚姻状况', help_text='婚姻状况')

    marriage_qita = models.CharField(max_length=50, blank=True, null=True, verbose_name='婚姻状况-其他', help_text='婚姻状况-其他')

    first_marriage = models.IntegerField(blank=True, null=True, verbose_name='初婚年龄(岁)', help_text='初婚年龄(岁)')

    pregnancy_times = models.IntegerField(null=True, blank=True, verbose_name='孕', help_text='孕')

    pregnancy_shun = models.IntegerField(null=True, blank=True, verbose_name='顺产', help_text='顺产')

    pregnancy_pou = models.IntegerField(null=True, blank=True, verbose_name='剖宫产', help_text='剖宫产')

    pregnancy_yao = models.IntegerField(null=True, blank=True, verbose_name='药物流产', help_text='药物流产')

    pregnancy_ren = models.IntegerField(null=True, blank=True, verbose_name='人工流产', help_text='人工流产')

    pregnancy_zi = models.IntegerField(null=True, blank=True, verbose_name='自然流产', help_text='自然流产')

    pregnancy_yi = models.IntegerField(null=True, blank=True, verbose_name='异位妊娠', help_text='异位妊娠')

    pregnancy_qing = models.IntegerField(null=True, blank=True, verbose_name='清宫术', help_text='清宫术')

    pregnancy_qita = models.CharField(max_length=50, null=True, blank=True, verbose_name='孕产史-其他', help_text='孕产史-其他')

    pregnancy_nerver = models.CharField(max_length=4, blank=True, null=True, verbose_name='未避孕未孕', help_text='未避孕未孕')

    pregnancy_nerver_unit = models.CharField(max_length=2, blank=True, null=True, verbose_name='未避孕未孕-单位(月/年)', help_text='未避孕未孕-单位(月/年)')

    wu_is_history_disease = models.BooleanField(blank=True, null=True, verbose_name='遗传病-无', help_text='遗传病-无')

    is_history_disease = models.BooleanField(blank=True, null=True, verbose_name='遗传病', help_text='遗传病')

    is_history_disease_qita = models.CharField(max_length=50, blank=True, null=True, verbose_name='遗传病-其他', help_text='遗传病-其他')

    CHECKED_CHOICE = (
        ('未提交', '未提交'),
        ('已提交', '已提交'),
        ('审核通过', '审核通过'),
        ('审核不通过', '审核不通过'),
    )
    check_status = models.CharField(blank=True, null=True, default='未提交', verbose_name='审核状态', max_length=6, choices=CHECKED_CHOICE, help_text='审核状态')

    reason_for_check = models.CharField(blank=True, null=True, verbose_name='审核不通过的原因', max_length=200, help_text='审核不通过的原因')

    class Meta:
        verbose_name = '一般情况'
        verbose_name_plural = verbose_name
        ordering = ['-serial', ]
        permissions = (
            ('prj005_all_permissions', 'All Permissions'),
            ('prj005_other_permissions', 'Only User Permissions'),
            ('prj005_patient', 'Mobile add information'),
        )
